//青蛙frog        属性:名字，年龄       行为:吃虫子，蛙泳
//狗Dog           属性:名字，年龄       行为:吃骨头，狗刨(游泳)
//兔子rabbit      属性:名字，年龄       行为:吃胡萝卜
public class A54 {
    public static void main(String[] args) {
        Frog f = new Frog("小青", 1);
        System.out.println(f.getName());
        System.out.println(f.getAge());
        f.eat();
        f.swim();
    }
}
abstract class Animal{
    private String name;
    private int age;
    public Animal() {
    }
    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public abstract void eat();
}
interface Swim{
    public abstract void swim();
}
class Frog extends Animal implements Swim{
    public Frog() {
    }
    public Frog(String name, int age) {
        super(name, age);
    }
    @Override
    public void eat() {
        System.out.println("青蛙吃虫子");
    }
    @Override
    public void swim() {
        System.out.println("青蛙在蛙泳");
    }
}
class Dog extends Animal implements Swim{
    public Dog() {
    }
    public Dog(String name, int age) {
        super(name, age);
    }
    @Override
    public void eat() {
        System.out.println("狗吃骨头");
    }
    @Override
    public void swim() {
        System.out.println("狗在狗刨");
    }
}
class Rabbit extends Animal{
    public Rabbit() {
    }
    public Rabbit(String name, int age) {
        super(name, age);
    }
    @Override
    public void eat() {
        System.out.println("兔子吃胡萝卜");
    }
}
